package com.gf.framework.mongo.entity;

import com.gf.framework.common.model.user.UserContext;
import lombok.Data;
import org.bson.types.ObjectId;
import org.springframework.data.mongodb.core.index.Indexed;
import org.springframework.data.mongodb.core.mapping.Document;
import org.springframework.data.mongodb.core.mapping.Field;
import org.springframework.data.mongodb.core.mapping.FieldType;
import org.springframework.data.mongodb.core.mapping.MongoId;

import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @author gaofei
 * @date 2022/5/28 9:31
 */
@Data
public class BaseEntity implements Serializable {
    @Field("id")
    @Indexed(unique = true)
    private Long id;

    /**
     * 创建人（id）
     */
    private Long createUser;

    /**
     * 更新人（id）
     */
    private Long updateUser = UserContext.getUserId();
    /**
     * 更新时间
     */
    private LocalDateTime updateTime = LocalDateTime.now();
}
